<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<html>
<head>
<link href="${ctxStatic }/index/css/daycar3.css" rel='stylesheet' type='text/css' />
<jsp:include page="/WEB-INF/views/layouts/head.jsp"></jsp:include>
<script src="${ctxStatic}/jquery/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
	var suitrtnprice = ${tRentproduct.office.airPrice};
	$(function(){
		alert('${tRentproduct.office.id }');
		$("#bookingForm").validate({
			rules: {
				contacts: {
					required: true,
				},
				payertel:{
					required:true,
					isMobile : true
				}
			},
			messages: {
				contacts: {
					required: "",
				},
				payertel: {
					required: ""
				}
			}
		});
	        jQuery.validator.addMethod("isMobile", function(value, element) {
	            var length = value.length;
	            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
	            return this.optional(element) || (length == 11 && mobile.test(value));
	        }, "");
		$('#purchasenum').on('change',function(){
			var integer = /^[0-9]*[1-9][0-9]*$/;
			var val = $(this).val();
			if(val!='' && !integer.test(val)) {
				$(this).focus();
				$('#suitrtnprice').text("￥车辆数不正确！");
			} else {
				var totalprice = accMul(val,suitrtnprice);
				$('#suitrtnprice').text("￥"+totalprice.toFixed(2));
				$('#totalPrice').val(totalprice);
			}
		});
		$('#purchasenum').trigger('change');
	});
	function accMul(arg1, arg2) {
		var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
		try {
			m += s1.split(".")[1].length;
		} catch (e) {
		}
		try {
			m += s2.split(".")[1].length;
		} catch (e) {
		}
		return Number(s1.replace(".", "")) * Number(s2.replace(".", ""))
				/ Math.pow(10, m);
	}
</script>
</head>
<body>
	<div class="details_warp">
    <div class="details_main">
    <form id="bookingForm" action="${ctxFront}/sms/airbooking" method="post">	
    <input type="hidden" name="ordername" value="${tRentproduct.productname  }" />
    <input type="hidden" name="boardaddr" value="${tRentproduct.aboardAddress }" />
    <input type="hidden" name="departcity.sitename" value="${tRentproduct.departcity.sitename }" />
    <input type="hidden" name="destcity.sitename" value="${tRentproduct.destcity.sitename}" />
	<input type="hidden" name="ordertype" value="6" />
	<input type="hidden" name="totalPrice" value="" id="totalPrice" />
	<input type="hidden" name="office.id" value="${tRentproduct.office.id }" />
	<input type="hidden" name="office.name" value="${tRentproduct.office.abbr }" />
	<input type="hidden" name="office.iswifi" value="${tRentproduct.office.iswifi }" />
	<input type="hidden" name="office.powersupply" value="${tRentproduct.office.powersupply }" />
	<input type="hidden" name="office.tablewater" value="${tRentproduct.office.tablewater }" />
	<input type="hidden" name="office.businesssuit" value="${tRentproduct.office.businesssuit }" />
	<input type="hidden" name="office.paper" value="${tRentproduct.office.paper }" />
	<input type="hidden" name="fromdateStr" value="${tRentproduct.fromdateStr }" />
	<input type="hidden" name="time" value="${tRentproduct.time }" />
	<input type="hidden" name="cargotype.typedesc" value="${tRentproduct.cargotype.typedesc }" />
	<input type="hidden" name="cargotype.typename" value="${tRentproduct.cargotype.typename  }" />
	<input type="hidden" name="cargotype.cargotypeid" value="${tRentproduct.cargotype.cargotypeid  }" />
        <div class="de_page clearfix"> 
            <div class="depage_left">
                <div class="dp_information">
                    <div class="dp_info_title">
                        <h5>详情信息</h5>
                    </div>
                    <div class="product_i clearfix" style="width: 750px">
                        <div id="list" class="pro_1" style="float: left">
                            <div class="pro_prc">
                                <img src="${tRentproduct.cargotype.images }" />
                            </div>
                            <p class="prc_txt">${tRentproduct.cargotype.typename }</p>
                        </div>
                        <div class="product_explan">
                            <ul class="pro_list">
                                <li class="pro_si"><span class="prosi_tit">产品名称：</span><span class="prosi_txt">
                                <a href="javascript:void(0)" title="${tRentproduct.productname }">
				 <c:if test="${fn:length(tRentproduct.productname) > 25 }">
					${fn:substring(tRentproduct.productname,0,25)}...
				</c:if>
				<c:if test="${fn:length(tRentproduct.productname)  <= 25 }">
					${tRentproduct.productname }
				</c:if>
                       </a>         
                                </span></li>
                                <li class="pro_si"><span class="prosi_tit">上车地点：</span><span class="prosi_txt">${tRentproduct.aboardAddress }</span></li>
                                <li class="pro_si"><span class="prosi_tit">用车时间：</span><span class="prosi_txt">${tRentproduct.fromdateStr } ${tRentproduct.time }</span></li>
                                <li class="pro_si"><span class="prosi_tit">服务车队：</span><span class="prosi_txt">${tRentproduct.office.abbr }</span></li>
                                <li class="pro_si"><span class="prosi_tit">特色服务：</span>
                                <span class="prosi_txt"><c:if test="${tRentproduct.office.iswifi == '1' }">无线wifi</c:if>
							<c:if test="${tRentproduct.office.powersupply == '1' }">车载充电</c:if>
							<c:if test="${tRentproduct.office.tablewater == '1' }">免费饮用水</c:if>
							<c:if test="${tRentproduct.office.businesssuit == '1' }">商务正装</c:if>
							<c:if test="${tRentproduct.office.paper == '1' }">免费纸巾</c:if> 
                                </span></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="depage_main">
                    <div class="depage_box">
                        <ul class="depage_in_list">
                            <li class="dp_ils"><label for="车辆数">车辆数：</label>
       <input id="purchasenum" type="number" name="purchasenum" placeholder="请填写用车辆数" min="1" value='1'/></li>
                            <!--<li class="dp_ils"><label for="车辆数">上车地点 ：</label><input type="text" placeholder="请填写用车辆数" /></li>-->
                            <p style="border-bottom: 1px dashed #C0C0C0;margin: 20px 0;"></p>
                            <li class="dp_ils"><label for="联系人姓名">联系人：</label>
                            <input type="text" placeholder="联系人姓名" name="contacts" /></li>
                            <li class="dp_ils"><label for="联系电话">联系电话：</label>
                            <input type="text" placeholder="输入手机号" name="payertel" value=""/></li>
                        </ul>
                    </div>
                    <div class="de_notice">
                        <p>重要提示：</p>
                        <p>1.如您的预订时间距离发车时间在12小时以内，为保证您的顺利出行，请保持您的电话畅通。</br>
                            2.如产生不含费用项请在服务结束后，将钱面付司机。严禁司机额外乱收费，如发现可联系霞客约车客服核实退还。</br>
                            3.开具发票:如需发票，由霞客约车根据订单金额统一开具。请在服务完成后至我的账户—关于发票—立即开票填写开票信息，开票总金额为订单费用。</br>
                            4.接送站包车一口价产品不能临时改变路线。如您需要送达同城多个地址或在多个地址上车，司机会合理安排行驶路线。如您需要送达多个城市或在多个城市上车，请分开下单。
                            </p>
                    </div>
                </div>
            </div>
            <div class="depage_right">
                <div class="depage_cost">
                    <i class="cost_icon"></i>
                    <h5>费用明细：</h5>
                    <p style="text-align: justify;">
                        费用包含：【一价全包】全程司机代驾服务费、车辆使用费、车辆油电费、 空驶费、夜间服务费、司机小费、路桥费、停车费、摆渡费。
                    </p>
                    <p class="cost_ing">
                        <span>价格：</span>
                        <span id="suitrtnprice">
  <c:set var="totalPrice" value="${tRentproduct.office.airPrice }"/>${totalPrice}   	                      
                       </span>
                    </p>
                    <div class="cost_fg" onclick="$('#bookingForm').submit();">
                     <button class="reserve" id="subBtn">预定</button></a>
                    </div>
                </div>
                <div class="depage_cancel">
                    <i class="cancel_icon"></i>
                    <h5>取消须知：</h5>
                    <p>
●该产品支持取消。<br>
●出行日期前24小时前取消，免收违约金；<br>
●出行日期前24小时至12小时取消，收取费用总额10%的违约金；<br>
●出行日期前12小时至2小时取消，收取费用总额30%的违约金；<br>
●出行开始前2小时取消，收取全额费用的违约金；<br>
●超过发车时间不可退款。<br>
●如需改期，请申请取消后重新预订。<br>
                    </p>
                </div>
            </div>
        </div></form>
    </div>
</div>
</body>
<jsp:include page="/WEB-INF/views/layouts/foot.jsp"></jsp:include>
</html>